{% if orderType === 0 %}

{% extends "view/center/inc/base.html" %}

{% block content %}
<section>
    <div class="container">
        {% if setp == 3%}
        <div class="row process-wizard process-wizard-primary">

            <div class="col-xs-3 process-wizard-step complete">
                <div class="text-center process-wizard-stepnum">第一步</div>
                <div class="progress">
                    <div class="progress-bar"></div>
                </div>
                <a href="#" class="process-wizard-dot"></a>
                <div class="process-wizard-info text-center">购物车</div>
            </div>

            <div class="col-xs-3 process-wizard-step complete">
                <!-- complete -->
                <div class="text-center process-wizard-stepnum">第二步</div>
                <div class="progress">
                    <div class="progress-bar"></div>
                </div>
                <a href="#" class="process-wizard-dot"></a>
                <div class="process-wizard-info text-center">确认订单信息</div>
            </div>

            <div class="col-xs-3 process-wizard-step active">
                <!-- complete -->
                <div class="text-center process-wizard-stepnum">第三步</div>
                <div class="progress">
                    <div class="progress-bar"></div>
                </div>
                <a href="#" class="process-wizard-dot"></a>
                <div class="process-wizard-info text-center">选择支付</div>
            </div>

            <div class="col-xs-3 process-wizard-step disabled">
                <!-- active -->
                <div class="text-center process-wizard-stepnum">第四步</div>
                <div class="progress">
                    <div class="progress-bar"></div>
                </div>
                <a href="#" class="process-wizard-dot"></a>
                <div class="process-wizard-info text-center">订购完成</div>
            </div>

        </div>

        <div class="alert alert-mini alert-success margin-bottom-20">
            <!-- SUCCESS -->
            <button data-dismiss="alert" class="close" type="button"><span aria-hidden="true">×</span><span
                    class="sr-only">Close</span></button>
            <strong> <i class="fa fa-check "></i> 尊敬的 {{controller.user.username}}，</strong> 订单已成功提交！
        </div>
        {%endif%}
        <div class="panel panel-default margin-bottom-20">
            <div class="panel-body ">

                <div class="heading-title heading-dotted text-center margin-bottom-20">
                    <h4><span>[支付信息]</span></h4>
                </div>
                {%if order.type == 0%}
                <div class="alert alert-mini alert-warning ">
                    <!-- WARNING -->
                    <button data-dismiss="alert" class="close" type="button"><span aria-hidden="true">×</span><span
                            class="sr-only">Close</span></button>
                    <i class="fa fa-hourglass-half"></i> 请您在提交订单后 <span class="countdown countdown-inline"
                        data-from="{{order.end_time}}" data-labels="年,月,周,日,时,分,秒">
                        <!-- Example Date From: December 31, 2018 15:03:26 --></span>
                    内完成支付，否则订单会自动作废。

                </div>
                {%endif%}
                <div class="table-responsive">
                    <table class="table">

                        <tbody>
                            <tr>
                                <td class="text-right">订单编号：</td>
                                <td>{{order.order_no}}</td>
                            </tr>
                            <tr class="danger ">
                                <td class="text-right">订单金额：</td>
                                <td class="text-danger size-18">￥{{order.order_amount|formatCurrency}}</td>
                            </tr>
                            <tr class="">
                                <td class="text-right">支付方式：</td>
                                <td>
                                    <div class="pay-box">


                                        <div class="icheck pay-list m-b">
                                            {% for val in payList %}
                                            <div class="item">
                                                <input type="radio" name="payment" value="{{val.id}}" {% if val.id==
                                                       order.payment %} checked {% endif%}>
                                                <label><img src="{{val.logo_url}}" /> {{val.title}} </label>
                                            </div>
                                            {% endfor %}
                                            {% if config.setup.PREPAID == 0 and order.type === 0 %}
                                            <div class="item">
                                                <input type="radio" name="payment" value="100" {% if paylist|length == 0  or 100==
                                                       order.payment %} checked {% endif%}>
                                                <label><img src="/static/admin/img/pingxx/yfk.png" /> 预付款支付 </label>
                                            </div>
                                            {% endif %}
                                            {% if config.setup.COD == 0 and order.type === 0 %}
                                            <div class="item">
                                                <input type="radio" name="payment" value="1001" {% if (paylist|length == 0 and controller.setup.PREPAID == 1) or 1001==
                                                       order.payment %} checked {% endif%}>
                                                <label><img src="/static/admin/img/pingxx/hdfk.png" /> 货到付款 </label>
                                            </div>
                                            {% endif %}
                                        </div>


                                    </div>
                                </td>
                            </tr>

                        </tbody>
                    </table>
                </div>


            </div>

        </div>

        <div class="callout alert alert-default  noborder">
            <input type="hidden" value="{{order.id}}" name="order_id">
            <div class="text-center">
                <a class="btn btn-3d btn-reveal btn-green pay-submit" href="javascript:;">
                    <i class="fa fa-credit-card"></i>
                    <span>立即支付</span>
                </a>


            </div>

        </div>
    </div>
</section>

{% endblock %}

{% block script%}

<script>
    $('.pay-submit').click(function () {
        var orderId = $('input[name="order_id"]').val();
        var payment = $('input[name="payment"]:checked').val();

        location.href = '/pay/' + orderId + '/' + payment;
    });
</script>

{% endblock %}

{% else %}

<div class="modal-dialog modal-md ajax-edit-addr-modal">
    <div class="modal-content">

        <!-- header modal -->
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                    aria-hidden="true">&times;</span></button>
            <h4 class="modal-title " id="myLargeModalLabel">{{controller.meta_title}}</h4>
        </div>

        <!-- body modal -->
        <div class="modal-body">
            <form method="post" class="ext-recharge">
                <fieldset>
                    <!-- required [php action request] -->

                    <div class="row">
                        <div class="form-group">
                            <div class="col-md-4 col-sm-4">
                                <label>充值金额 *</label>
                                <div class="fancy-form">
                                    <i class="fa fa-cny"></i>

                                    <input type="text" class="form-control" placeholder="充值金额" name="order_amount">

                                    <!-- tooltip - optional, bootstrap tooltip can be used instead -->
                                    <span class="fancy-tooltip top-left">
                                        <!-- positions: .top-left | .top-right -->
                                        <em>最小金额不小于0.01!</em>
                                    </span>
                                </div>
                            </div>

                        </div>
                    </div>
                    <div class="row">
                        <div class="form-group">
                            <div class="col-md-12 col-sm-12">
                                <label>选择支付方式 *</label>
                                <div class="pay-box">

                                    <div class="icheck pay-list m-b">
                                        {% for val in payList %}
                                        <div class="item">
                                            <input type="radio" name="payment" value="{{val.id}}" {% if val.id == 1 %}
                                                checked {% endif%}>
                                            <label><img src="{{val.logo_url}}" /> {{val.title}} </label>
                                        </div>
                                        {% endfor %}

                                    </div>

                                </div>
                            </div>
                        </div>
                    </div>

                </fieldset>
                <div class="row">
                    <div class="col-md-12">
                        <button class="btn btn-3d btn-teal btn-lg btn-block margin-top-30" type="submit">
                            立即充值
                        </button>
                    </div>
                </div>

            </form>
        </div>

    </div>
</div>
<script>
    _icheck();
</script>

<script>
    $(document).on('submit', 'form.ext-recharge', function (e) {
        var data = $(this).serialize();

        $.ajax({
            type: 'POST',
            url: '/center/account/recharge',
            data: data,
            success: function (res) {
                if (res.errno == 1000) {
                    _toastr(res.errmsg, 'top-right', 'error', false);
                    return false;
                } else if (res.data.data.url) {
                    _toastr(res.data.name, 'top-right', 'success', false);
                    setTimeout(function(){
                        window.location.href = res.data.data.url;
                    }, 1000)
                }
            }

        });
        return false;
    });
</script>

{% endif %}